/*
 * @(#)AttributeValue.java   1.0   May 7, 2007
 *
 * Copyright 2000-2007 ETH Zurich. All Rights Reserved.
 *
 * This software is the proprietary information of ETH Zurich.
 * Use is subject to license terms.
 *
 * @(#) $Id: AttributeValue.java 427 2007-05-19 23:35:07Z D\aldespin $
 */
package ch.ethz.globis.javaom.core;

import ch.ethz.globis.javaom.system.Metadata;

/**
 * @author aldespin
 * @version 1.0
 */
public class AttributeValue<T> extends Object {

   private T value;

   public AttributeValue(final Metadata metadata, final T value) {
      super(metadata);
      this.value = value;
   }

   public AttributeValue(final Object type, final T value) {
      super();
      this.value = value;
      // dress with object and type
      this.dress(Metadata.METADATA.getTypeObject(Metadata.OBJECT));
      this.dress(type);
   }

   public void setValue(final T value) {
      this.value = value;
   }

   public T getValue() {
      return this.value;
   }

   /**
    * {@inheritDoc}
    */
   @Override
   public String toString() {
      final StringBuffer result = new StringBuffer();
      result.append("<attributevalue id=\"" + this.getID() + "\">");
      result.append(this.value.toString());
      result.append("</attributevalue>");
      return result.toString();
   }
}
